@extends('admin/layout')
@section('content')
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
        <li><a href="#">管理员</a></li>
        <li><a href="#">用户列表</a></li>
        <li class="active">修改用户信息</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <!-- left column -->
        <div class="col-md-12" style="width: 100%;">
          <!-- general form elements -->
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title"></h3>
            </div>
            <!-- /.box-header -->
            <span id="msg" style="display: none">
              @if (count($errors) > 0)
                @foreach ($errors->all() as $error)
                  <div style="width: 100%;">
                    <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                  </div>
                @endforeach
              @endif
            </span>
            <script type="text/javascript">
              var _msg = $('#msg div span').text();
              console.log(_msg);
              if(_msg != ''){
                layer.msg(_msg);
              }
            </script>
            <!-- form start -->

            <form role="form" action="{{ url('admin/updateManage') }}" method="post">
              {{ csrf_field() }}
              <input type="hidden" name="id" value="{{ $list['id'] }}" />
              <div class="box-body" style="width: 50%;">
              <div class="form-group">
                <label for="exampleInputEmail1">用户名称</label>
                <input type="text" name="name" class="form-control" id="exampleInputEmail1" placeholder="manage name" value="{{$list['username']}}">
              </div>
              <div class="form-group">
                <label for="exampleInputEmail1">输入新密码</label>
                <input type="password" name="password" class="form-control" id="exampleInputEmail1" placeholder="new password">
              </div>
                <div class="form-group">
                  <label for="exampleInputEmail1">用户邮箱</label>
                  <input type="text" name="email" class="form-control" id="exampleInputEmail1" placeholder="manage email" value="{{$list['email']}}">
                </div>
                <div class="form-group">
                  <label for="exampleInputEmail1">用户电话</label>
                  <input type="text" name="phone" class="form-control" id="phone " placeholder="manage phone" value="{{$list['phone']}}">
                </div>
                @if($list['roleid'] == 3)
                  <div class="form-group" >
                    <label for="exampleInputEmail1">所属业务经理：</label>
                    <select name="man">
                      <option value="{{ $list['son_id'] }}">{{ App\Manage::find($list['son_id'])['username'] }}</option>
                      @foreach($man as $value)
                        <option value="{{ $value['id'] }}">{{ $value['username'] }}</option>
                      @endforeach
                    </select>
                  </div>
                 @endif
              </div>
              <!-- /.box-body -->

              <div class="box-footer">
                <button type="submit" class="btn btn-primary">提交客户</button>
              </div>
            </form>

          </div>
          <!-- /.box -->

        </div>

        <!--/.col (right) -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
@stop
